import request from '@/utils/request'
import type {
  GetRecomTravelResponse,
  DeleteRecomTravelResponse,
  GetAllUserTravelResponse,
  SubmitRecomTravelResponse,
} from '@/type/reco-travel'
// 获取四个推荐游记
export const getRecomTravelAPI = (): Promise<GetRecomTravelResponse> => {
  return request.get('/apif/gainRecomTravel')
}

// 删除推荐游记
export const deleteRecomTravelAPI = (_id: string): Promise<DeleteRecomTravelResponse> => {
  return request.delete(`/apif/deleteRecomTravel`, {
    data: {
      _id,
    },
  })
}

// 获取全部游记
export const getAllUserTravelAPI = (page: number): Promise<GetAllUserTravelResponse> => {
  return request.get('/apif/allUserTravel', {
    params: {
      page,
    },
  })
}

// 提交四个推荐游记
export const submitRecomTravelAPI = (data: {
  imageUrl: string
  travel_id: string
}): Promise<SubmitRecomTravelResponse> => {
  return request.post('/apif/uploadFourTravel', data)
}

//修改更新四个推荐游记
export const modifyRecomTravelAPI = (data: {
  _id: string
  imageUrl: string
  travel_id: string
}): Promise<SubmitRecomTravelResponse> => {
  return request.put('/apif/modifyRecomTravel', data)
}
